<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initAutoload()
    {
        $moduleLoader = new Zend_Application_Module_Autoloader(
                array(
                    'namespace'=>'',
                    'basePath'=>APPLICATION_PATH,
                    ));
        
        $auto = Zend_Loader_Autoloader::getInstance();
        $auto->registerNamespace(array('Child_'));
        
        return $moduleLoader;
    }

    protected function  _initVievHelpers()
    {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();
        $view->headMeta()->appendHttpEquiv('Content-Type','text/html;charset=utf8'); 
        $view->headTitle('ChildHobby');
        $view->headTitle()->setSeparator(' :: ');
        
        if(!Zend_Auth::getInstance()->hasIdentity()){
            $view->identity = false;
        } else {
            $view->identity = Zend_Auth::getInstance()->getIdentity();
        }
        
    }
    protected function _initDb(){
 
        $resource =  $this->GetPluginResource('db');
        Zend_Registry::set('db',$resource->getDbAdapter());
        Zend_Db_Table_Abstract::setDefaultAdapter($resource->getDbAdapter());
    }
    
//    protected function _initDB() {
//
//       $dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini');
//       $dbAdapter = Zend_Db::factory($dbConfig->adapter, array(
//            'host'     => $dbConfig->hostname,
//            'username' => $dbConfig->username,
//            'password' => $dbConfig->password,
//            'dbname'   => $dbConfig->dbname
//        ));
//
//        My_Db_Table_Abstract::setDefaultAdapter($dbAdapter);
//
//        Zend_Registry::set('db', $dbAdapter);
//
//
//        if (APPLICATION_ENV == 'development') {
//            $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
//            $profiler->setEnabled(true);
//            $dbAdapter->setProfiler($profiler);
//        }
//    }

    
//    protected function _initPlugins()
//    {
//        $front = Zend_Controller_Front::getInstance();
//        $front->registerPlugin(new Plugin_Acl());
//    }


//    protected function _initEmail()
//    {
//        $email_config = array(
//            'auth' => 'plain',
//            'username' => 'valera',
//            'password' => 'valera',
//            'ssl' => 'tsl',
//            'port' => 25
//        );
//        $transport = new Zend_Mail_Transport_Smtp(localhost, $email_config);
//        Zend_Mail::setDefaultTransport($transport);
//    }
}
